package com.hzk.controller;


import com.hzk.plug_in.myparam;
import com.hzk.pojo.UserBasic;
import com.hzk.service.IUserBasicService;
import com.hzk.vo.CaseUser;
import com.hzk.vo.RespBean;
import com.hzk.vo.RespBeanEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@RequestMapping("/user-basic")
public class UserBasicController {
    @Autowired
    IUserBasicService iUserBasicService;
    @RequestMapping("/main")
    @ResponseBody
    public RespBean my(@CaseUser UserBasic user) {
        if (user==null){
            return  RespBean.error(RespBeanEnum.NULL_USER_ERROR);
        }
        UserBasic userBasic = iUserBasicService.getById(user.getId());
        myparam myparam = new myparam();
        myparam.setUsername(userBasic.getUsername());
        myparam.setMobile(String.valueOf(userBasic.getId()));
        myparam.setCardMoney(String.valueOf(userBasic.getCardMoney()));
        myparam.setXiangmi(String.valueOf(userBasic.getTaomi()));
        return RespBean.success(myparam);
    }
}
